/**
 * 
 */
package optimization.naturalOptimization.particleSwarmOptimization;

import java.util.ArrayList;

import optimization.naturalOptimization.population.individual.pso.DoubleArrayInertiaWeightPSOParticle;
import optimization.naturalOptimization.population.individual.pso.Particle;

/**
 * This class provides the inertia weight pso algorithm.
 * 
 * @author Kevin Wagner
 * @version 1.0
 */
public class InertiaWeightPSO extends ParticleSwarmOptimization {

	/*
	 * (non-Javadoc)
	 * 
	 * @see optimization.IdentificationI#getIndentification()
	 */
	@Override
	public String getIndentification() {
		return "Inertia Weight PSO";
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see optimization.naturalOptimization.particleSwarmOptimization.
	 * ParticleSwarmOptimization#getNewParticle()
	 */
	@SuppressWarnings("rawtypes")
	@Override
	public Particle getNewParticle() {
		return new DoubleArrayInertiaWeightPSOParticle(getSwarm());
	}

	/**
	 * Returns the weight parameter of this pso algorithm.
	 * 
	 * @return the weight parameter
	 */
	public double getWeight() {
		return Double.valueOf(getProperties().getProperty("inertiaWeight", "1.0"));
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see optimization.naturalOptimization.particleSwarmOptimization.
	 * ParticleSwarmOptimization#getParameters()
	 */
	@Override
	public ArrayList<String> getParameters() {
		ArrayList<String> parameters = super.getParameters();
		parameters.add("Inertia Weight");
		return parameters;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see optimization.naturalOptimization.particleSwarmOptimization.
	 * ParticleSwarmOptimization#getParameterConfiguration()
	 */
	@Override
	public ArrayList<String> getParameterConfiguration() {
		ArrayList<String> parameters = super.getParameterConfiguration();
		parameters.add(getWeight()+"");
		return parameters;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see optimization.naturalOptimization.particleSwarmOptimization.
	 * ParticleSwarmOptimization#performStep()
	 */
	@Override
	public boolean performStep() {
		boolean status = super.performStep();
		return status;
	}

}
